home *** CD-ROM | disk | FTP | other *** search
/ Robotics & Artificial Int…3 (Professional Edition) / Robotics & Artificial Intelligence Tools 2003 (Professional Edition).iso / neural network tool and application / nsinstall.exe / data1.cab / InteractiveBook_Files / Examples / Chapter1 / Scheduling / 2 recreate breadboard.nsm < prev    next >
Encoding:
Text File  |  2002-03-08  |  6.8 KB  |  189 lines

  1. //activeBreadboard. lockWindowUpdate()
  2. //
  3. // This macro creates the standard linear regression breadboard
  4. //
  5. subtitleTextBox. setText ("")
  6. mainTextBox. setText ("")
  7. //
  8. // drop down input axon and file icon
  9. //
  10. activeBreadboard. setAnimatePoint ( 20 , 225 )
  11. activeBreadboard. stampAndMove ( "Axon" , "inputAxon" )
  12. inputAxon. setRows ( 1 )
  13. activeBreadboard. stampOnAndMove ( "File" , "inputAxon" )
  14. file. setName ("inputFile")
  15. inputFile. setActiveAccessPoint ( "Pre-Activity" )
  16. inputFilePath = macro. pathFromMacro ( "regression input.asc" )
  17. inputFile. addFile ( inputFilePath , FALSE )
  18. inputFile. setActiveTranslatorName ( "ASCII - Column" , FALSE )
  19. inputFile. setNormalize ( FALSE )
  20. inputFile. translate (  )
  21. //
  22. // put down synapse and bias axon
  23. //
  24. activeBreadboard. setAnimatePoint ( 110 , 225 )
  25. activeBreadboard. stampAndMove ( "FullSynapse" , "hidden1Synapse" )
  26. inputAxon. connectTo ( "hidden1Synapse" )
  27. activeBreadboard. setAnimatePoint ( 200 , 225 )
  28. activeBreadboard. stampAndMove ( "Axon" , "outputAxon" )
  29. outputAxon. setRows ( 1 )
  30. hidden1Synapse. connectTo ( "outputAxon" )
  31. //
  32. // put down controller
  33. //
  34. activeBreadboard. setAnimatePoint ( 15 , 200 )
  35. activeBreadboard. stampAndMove ( "StaticControl" , "control" )
  36. control. setEpochs ( 1 )
  37. activeBreadboard. stampOnAndMove ( "DataStorage" , "inputAxon" )
  38. dataStorage. setName("inputActivityStorage")
  39. activeBreadboard. stampOnAndMove ( "ScatterPlot" , "inputActivityStorage" )
  40. scatterPlot. setName("inputActivityScatterPlot")
  41. activeBreadboard. stampOnAndMove ( "DataStorageTransmitter" , "outputAxon" )
  42. dataStorageTransmitter. setName("outputActivityTransmitter")
  43. outputActivityTransmitter. setActiveAccessPoint ( "Activity" )
  44. outputActivityTransmitter. toggleConnection ( "inputActivityStorage" , "attachToBuffer" )
  45. // 
  46. // add l2 and viewer
  47. //
  48. activeBreadboard. setAnimatePoint ( 310 , 225 )
  49. activeBreadboard. stampAndMove ( "L2Criterion" , "criterion" )
  50. outputAxon. connectTo ( "criterion" )
  51. activeBreadboard. stampOnAndMove ( "File" , "criterion" )
  52. file. setName(desiredFile)
  53. desiredFile. setActiveAccessPoint ( "Desired Signal" )
  54. desiredFilePath = macro. pathFromMacro ( "regression desired.asc" )
  55. desiredFile. addFile (desiredFilePath , FALSE )
  56. activeBreadboard. select ( "desiredFile" , FALSE )
  57. desiredFile. setNormalize ( FALSE )
  58. activeBreadboard. stampOnAndMove ( "DataStorageTransmitter" , "desiredFile" )
  59. dataStorageTransmitter. toggleConnection ( "inputActivityStorage" , "attachToBuffer" )
  60. //
  61. // add scatter plot
  62. //
  63. inputActivityStorage. setMessageEvery ( 12 )
  64. inputActivityScatterPlot. openEngineWindow (  )
  65. inputActivityScatterPlot. setXMaxScale (12.0000 )
  66. inputActivityScatterPlot. setXMinScale ( -1.0000 )
  67. inputActivityScatterPlot. setYMaxScale ( 10.000000 )
  68. inputActivityScatterPlot. setYMinScale ( -10.000000 )
  69. inputActivityScatterPlot. setBroadcast ( TRUE )
  70. inputActivityScatterPlot. setDotSize ( 3 )
  71. inputActivityScatterPlot. setBroadcast ( FALSE )
  72. inputActivityScatterPlot. setActiveChannel ( 2 )
  73. inputActivityScatterPlot. setVisible ( TRUE )
  74. inputActivityScatterPlot. setActiveChannel ( 1 )
  75. inputActivityScatterPlot. setVisible ( TRUE )
  76. inputActivityScatterPlot. setActiveChannel ( 0 )
  77. inputActivityScatterPlot. setVisible ( FALSE )
  78. inputActivityScatterPlot. setFixWindowTitle ( TRUE )
  79. inputActivityScatterPlot. setWindowTitle ( "Input Data (red) and Regression Line (blue)" )
  80. inputActivityScatterPlot. tileWindow(1,3,3,3)
  81. //
  82. activeBreadboard. stampOnAndMove ( "MatrixViewer" , "criterion" )
  83. matrixViewer. setName(costViewer)
  84. costViewer. setActiveAccessPoint ( "Average Cost" )
  85. costViewer. setEnableLabels ( TRUE )
  86. costViewer. setAccessRows(FALSE)
  87. costViewer. setLabel ( "Mean Squared Error" )
  88. costViewer. setAccessRows ( TRUE )
  89. costViewer. setLabel ( "" )
  90. costViewer. openEngineWindow (  )
  91.  
  92.  
  93. hidden1Synapse. setWeightVariance(0)
  94. hidden1Synapse. setWeightMean(1)
  95. activeBreadboard. select ( NULL, FALSE )
  96.  
  97. //
  98. // add viewers
  99. //
  100. activeBreadboard. stampOnAndMove ( "MatrixViewer" , "hidden1Synapse" )
  101. matrixViewer. setName ( "weightViewer" )
  102. weightViewer. setActiveAccessPoint ( "Weights" )
  103. weightViewer. setEnableLabels ( TRUE )
  104. weightViewer. setLabel ( "w" )
  105. weightViewer. setAccessRows ( FALSE )
  106. weightViewer. setLabel ( "Weight" )
  107. weightViewer. openEngineWindow (  )
  108.  
  109. weightViewer. tileWindow(4,4,5,6)
  110. costViewer. tileWindow(4,4,6,6)
  111.  
  112. //
  113. // set initial conditions
  114. //
  115. hidden1Synapse. setWeightMean (1.000000 )
  116. hidden1Synapse. setWeightVariance ( .5 )
  117. hidden1Synapse. networkRandomize (  )
  118. //outputAxon. setWeightMean ( -1.000000 )
  119. //outputAxon. setWeightVariance ( .5 )
  120. //outputAxon. networkRandomize (  )
  121. control. setEpochs ( 1 )
  122. control. resetNetwork (  )
  123. control.runNetwork()
  124. //
  125. // add backprop layer
  126. //
  127. activeBreadboard. stampOnAndMove ( "BackStaticControl" , "control" )
  128. activeBreadboard. select ( "controlBackprop" , FALSE )
  129. controlBackprop. allocateBackpropPlane (  )
  130. hidden1SynapseBackpropGradient. setStepSize ( 0.020000 )
  131.  
  132. control. setEpochs ( 100 )
  133. //
  134. // add weight track
  135. //
  136. activeBreadboard. stampOnAndMove ( "DataStorage" , "weightViewer" )
  137. activeBreadboard. stampOnAndMove ( "MegaScope" , "dataStorage" )
  138. activeBreadboard. moveToBack (  )
  139. dataStorage. setMessageEvery ( 1 )
  140. dataStorage. setBufferLength ( 200 )
  141. dataStorage. setName ( "weightStorage" )
  142. megaScope. setName ( "weightScope" )
  143. weightScope. setSweepRate ( 20.000000 )
  144. weightScope. openEngineWindow (  )
  145. activeBreadboard. select ( "criterionBackprop" , FALSE )
  146. activeBreadboard. moveToBack (  )
  147. activeBreadboard. select ( "weightScope" , FALSE )
  148. weightScope. setAmplitude ( 0.100000 )
  149. weightScope. setVerticalPosVolts ( -0.400000 )
  150.  
  151. weightScope. setFixWindowTitle ( TRUE )
  152. weightScope. setWindowTitle ( "Weight Track" )
  153.  
  154. weightScope.tileWindow(2,3,3,3)
  155. //
  156. //
  157. //
  158. weightStorage. setMessageEvery ( 50 )
  159. weightStorage. setBufferLength ( 1210 )
  160. weightScope. setSweepRate ( 121.000000 )
  161.  
  162. controlBackprop. setBatch ( FALSE )
  163.  
  164. //
  165. // add run button
  166. //
  167. runPath = macro. pathFromMacro ( "..\add run button.nsm" )
  168. activeBreadboard. runMacro ( runPath )
  169. activeBreadboard. moveSelectionBy ( 450 , 200 )
  170. runPath= macro. pathFromMacro("..\reset and run.nsm")
  171. runButton. setMacroPath(runPath)
  172.  
  173. activeBreadboard.select(NULL, FALSE)
  174.  
  175.  
  176. activeBreadboard. stampOnAndMove ( "ArrowEngine" , "weightScope" )
  177. //
  178. // fill in text
  179. //
  180. TextBoxPath = macro. pathFromMacro("textbox1.txt")
  181. NextMacroPath = macro. pathFromMacro ( "3 add schedule.nsm" )
  182. nextButton. setMacroPath ( NextMacroPath )
  183. CancelMacroPath= macro.pathFromMacro("..\minimize.nsm")
  184. cancelButton. setMacroPath ( CancelMacroPath)
  185. TitleIndex = titleTextBox. setTextFromFile (TextBoxPath, TitleIndex)
  186. SubtitleIndex = subtitleTextBox. setTextFromFile (TextBoxPath, SubtitleIndex)
  187. MainIndex = mainTextBox. setTextFromFile (TextBoxPath, MainIndex)
  188. //activeBreadboard. unlockWindowUpdate()
  189.